package oop;

import java.util.Scanner;

/**
 * @ClassName : oop.Demo05
 * @Author : LV88VL
 * @Date: 2021/2/2 21:12
 * @Description : 方法调用
 */
public class Demo05 {
    /** 假发调用
     public static void main(String[] args) {
     int a = add(1, 2);
     System.out.println(a);
     }
     public static int add(int a,int b){
     return a+b;
     }
     */
   /**   键盘输入方法+函数调用
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x= scanner.nextInt();
        System.out.println("输入的x是"+x);
        int y= scanner.nextInt();
        System.out.println("输入的y是"+y);
        int w = max(x, y);
        System.out.println(w);
    }
    public static int max(int a,int b){
        if (a>b){
            return a;
        }else {
            return b;
        }
    }*/
   /**可变参数的使用
    * public static void main(String[] args) {
       oop.Demo05 demo = new oop.Demo05();
       int b=demo.max(6,2,3,4,5);
       System.out.println("最大数" + b);
   }
   public static int max( int...i) {
       int result = i[0];
       for (int a = 0; a < i.length; a++) {
           if (i[a] > result) {
               result = i[a];
           }
       }return result;
   }*/
   //递归调用：求阶乘
   public static void main(String[] args) {
       System.out.println("请输入一个数：");
       Scanner scanner = new Scanner(System.in);
       int a;
       a= scanner.nextInt();
       System.out.println(jie(a));
   }
   public static int jie(int a){
       if (a==1){
           return 1;
       }else {
           return a*jie(a-1);
       }
   }
}
